/* 
 *  Copyright (C) 2006 James Young
 * `gurumind(a)gmail.com
 * 
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace IPDEditor
{
    public partial class IPDEditorBase : UserControl
    {
        public IPDEditorBase()
        {
            InitializeComponent();
        }

        protected IPDVisualRecord _vr;

        public virtual IPDVisualRecord visualRecord
        {
            set
            {
                _vr = value;
            }
        }

        public virtual void FillData(IPDDatabase record)
        {
        }
        public virtual void FillData(IPDField field)
        {
        }
        public virtual void FillData(Dictionary<string, object> DataArray)
        { }

        protected void NotSupported()
        {
            MessageBox.Show("This function is not supported.");
        }

        protected virtual void CreateNew()
        {
            NotSupported();
        }

        protected virtual void Save()
        {
            NotSupported();
        }

        protected virtual void SetDefault()
        {
            NotSupported();
        }

        protected virtual void Delete()
        {
            NotSupported();
        }

        protected virtual void Import()
        {
            NotSupported();
        }

        private void tbeNew_Click(object sender, EventArgs e)
        {
            CreateNew();
        }

        private void tbeSave_Click(object sender, EventArgs e)
        {
            Save();
        }

        private void tbeSetdefault_Click(object sender, EventArgs e)
        {
            SetDefault();
        }

        private void tbeDelete_Click(object sender, EventArgs e)
        {
            Delete();
        }

        private void tbeImport_Click(object sender, EventArgs e)
        {
            Import();
        }

        protected virtual string EditorName
        {
            get
            {
                return null;
            }
        }

        private void IPDEditorBase_Load(object sender, EventArgs e)
        {
            if (EditorName == "")
                tbeLabel.Text = "Visual Editor Not Implimented";
            else
                tbeLabel.Text = EditorName + " Visual Editor";
        }

    }
}
